﻿@{
    List<SelectListItem> siteList = ViewBag.siteList;
}
@model DTcms.Model.sites
<form id="form1" class="layui-form" url="SiteSave?action=@ViewBag.action&id=@ViewBag.id">
    @Html.AntiForgeryToken()
    <!--导航栏-->
    <div class="pageheader">
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li><a href="../channel/site_list" class="back"><i class="fa fa-mail-reply-all"></i> 返回列表页</a></li>
                <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
                <li><a href="../channel/site_list">站点管理</a> </li>
                <li><a href="javascript:;">编辑站点</a> </li>
            </ul>
        </div>
    </div>
    <!--/导航栏-->
    <!--内容-->
    <div class="layui-fluid">
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title" id="floatHead">
                <li class="layui-this">站点设置</li>
                <li>网站信息</li>
                <li>百度推送</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">站点名称</label>
                        <div class="layui-input-block">
                            @Html.TextBox("title", Model.title, new { @class = "input normal", datatype = "*2-100", sucmsg = " " })
                            <span class="Validform_checktip">*标题备注，允许中文。</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">生成目录名</label>
                        <div class="layui-input-block">
                            @Html.TextBox("build_path", Model.build_path, new { @class = "input normal", datatype = @"/^[a-zA-Z0-9\-\_]{2,50}$/", errormsg = "请填写正确的名称！", sucmsg = " " })
                            <span class="Validform_checktip">*频道分类目录，只允许使用英文、下划线。</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">绑定域名</label>
                        <div class="layui-input-block">
                            @Html.TextBox("domain", Model.domain, new { @class = "input normal", datatype = "url", errormsg = "请输入正确的域名！", sucmsg = " " })
                            <span class="Validform_checktip">*不能和主域名相同，域名去除“http://”部分。</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否启用</label>
                        <div class="layui-input-block">
                            @Html.CheckBox("is_lock", Model.is_lock == 0, new { title = "是" })
                            <span class="Validform_checktip">*不启用则不加载该站点</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否默认</label>
                        <div class="layui-input-block">
                            @Html.CheckBox("is_default", Model.is_default == 1, new { title = "是" })
                            <span class="Validform_checktip">*只允许一个默认站点，默认则不能绑定域名。</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">站点类型</label>
                        <div class="layui-input-block">
                            @Html.RadioButton("site_type", 1, Model.site_type == 1, new { title = "电脑站" })
                            @Html.RadioButton("site_type", 2, Model.site_type == 2, new { title = "移动站" })
                            @Html.RadioButton("site_type", 3, Model.site_type == 3, new { title = "微信站" })
                            <span class="Validform_checktip">*关系到模板选择</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">继承站点</label>
                        <div class="layui-input-block">
                            @Html.DropDownList("inherit_id", new SelectList(siteList, "Value", "Text", Model.inherit_id), new { datatype = "*", sucmsg = "" })
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">排序数字</label>
                        <div class="layui-input-block">
                            @Html.TextBox("sort_id", Model.sort_id, new { @class = "input small", datatype = "n", sucmsg = " " })
                            <span class="Validform_checktip">*数字，越小越向前</span>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">网站名称</label>
                        <div class="layui-input-block">
                            @Html.TextBox("name", Model.name, new { @class = "input normal", datatype = "*2-255", sucmsg = " " })
                            <span class="Validform_checktip">*任意字符，控制在255个字符内</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">网站LOGO</label>
                        <div class="layui-input-block">
                            @Html.TextBox("logo", Model.logo, new { @class = "input normal upload-path" })
                            <div class="upload-box choose-pick"><a href="javascript:;" class="webuploader-pick" title="图片空间">选择图片</a></div>
                            <div class="upload-box upload-img"></div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公司名称</label>
                        <div class="layui-input-block">
                            @Html.TextBox("company", Model.company, new { @class = "input normal" })
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">通讯地址</label>
                        <div class="layui-input-block">
                            @Html.TextBox("address", Model.address, new { @class = "input normal" })
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-block">
                            @Html.TextBox("tel", Model.tel, new { @class = "input normal" })
                            <span class="Validform_checktip">*非必填，区号+电话号码</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">传真号码</label>
                        <div class="layui-input-block">
                            @Html.TextBox("fax", Model.fax, new { @class = "input normal" })
                            <span class="Validform_checktip">*非必填，区号+传真号码</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">电子邮箱</label>
                        <div class="layui-input-block">
                            @Html.TextBox("email", Model.email, new { @class = "input normal" })
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">网站备案号</label>
                        <div class="layui-input-block">
                            @Html.TextBox("crod", Model.crod, new { @class = "input normal" })
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">首页标题(SEO)</label>
                        <div class="layui-input-block">
                            @Html.TextBox("seo_title", Model.seo_title, new { @class = "input normal" })
                            <span class="Validform_checktip">*自定义的首页标题</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">页面关健词(SEO)</label>
                        <div class="layui-input-block">
                            @Html.TextArea("seo_keywords", Model.seo_keywords, new { @class = "input normal" })
                            <span class="Validform_checktip">页面关键词(keyword)</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">页面描述(SEO)</label>
                        <div class="layui-input-block">
                            @Html.TextArea("seo_description", Model.seo_description, new { @class = "input normal" })
                            <span class="Validform_checktip">页面描述(description)</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">底部版权信息</label>
                        <div class="layui-input-block">
                            @Html.TextArea("copyright", Model.copyright, new { @class = "input" })
                            <span class="Validform_checktip">支持HTML</span>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">开启推送</label>
                        <div class="layui-input-block">
                            @Html.CheckBox("bdsend", Model.bdsend == 1, new { title = "是" })
                            <span class="Validform_checktip">*建议只有在正式环境中使用。</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">TOKEN</label>
                        <div class="layui-input-block">
                            @Html.TextBox("bdtoken", Model.bdtoken, new { @class = "input normal" })
                            <span class="Validform_checktip">准入密钥(description)</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--/内容-->

    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-wrap">
            <button class="layui-btn icon-btn" id="btnSubmit"><i class="layui-icon layui-icon-ok"></i>提交保存</button>
            <button class="layui-btn layui-btn-warm icon-btn" name="btnReturn" onclick="javascript:history.back(-1);"><i class="layui-icon layui-icon-return"></i>返回上一页</button>
        </div>
    </div>
    <!--/工具栏-->
</form>
@section Scripts{
    <script type="text/javascript" src="/scripts/libs/js/uploader.js"></script>
    <script type="text/javascript">
        layui.use(['validform', 'element', 'jqueryform', 'fileChoose'], function () {
            var fileChoose = layui.fileChoose;
            $('.choose-pick').click(function () {
                var obj = $(this);
                fileChoose.open({
                    fileUrl: '',
                    listUrl: '/admin_ajax/files',
                    num: 1,
                    dialog: {
                        offset: '60px'
                    },
                    onChoose: function (res) {
                        if (res[0].type != "file") {
                            layer.msg('我只让你选择图片格式的文件', { icon: 2, time: 2000 }, function () { });
                            return;
                        }
                        obj.siblings(".upload-path").val(res[0].url);
                        obj.siblings(".layer-photos").show().find("img").attr("src", res[0].url);
                    }
                });
            });
            //初始化表单验证
            $("#form1").initValidform('#btnSubmit', 1);
            //初始化上传控件
            $(".upload-img").InitUploader({ sendurl: "/upload_ajax/action", swf: "/scripts/libs/module/uploader/uploader.swf" });
        });
    </script>
}
